package com.crm.controller;

import com.crm.common.CallBack;
import com.crm.common.Response;
import com.crm.service.System.Systeminface;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;

@Api(tags = "系统管理")
@RequestMapping(path = "/system/")
@RestController
public class AndroidSystem {

    @Autowired
    private Systeminface system;

    @ApiOperation(value="CheckVersion")
    @RequestMapping(path="/CheckVersion",method= RequestMethod.POST)
    @ApiImplicitParam(name = "version", value = "version", required = false)
    public Response CheckVersion(HttpServletResponse response,final String version){
        system.CheckVersion(response,"12");
        return null;
//        return new CallBack() {
//            @Override
//            protected Object run() {
//                system.CheckVersion(request,response,version);
//                return null;
//            }
//        }.execute();
    }

    @ApiOperation(value="test")
    @RequestMapping(path="/test",method= RequestMethod.POST)
//    @ApiImplicitParam(name = "version", value = "version", required = false)
    public Response test(@RequestBody Map<String,Object>map){
        return new CallBack() {
            @Override
            protected Object run() {
                System.out.println("xxx"+map.toString());
                Map<String,String>map = new HashMap<>();
                map.put("tx","xx2");
                return map;
            }
        }.execute();
    }

}
